<?php

	define("USER_TIMEOUT", 18000); /*10 minutos*/
	
	DEFINE ('DB_USER', 'root');
	if($_SERVER['SERVER_NAME']=="localhost")
	{
		DEFINE ('DB_PASSWORD', '123456');
	}
	else
	{
		DEFINE ('DB_PASSWORD', 'aeuuW6v1NpDm');
	}
	DEFINE ('DB_HOST', 'localhost');
	DEFINE ('DB_NAME', '212850_galander');

	function openDB($con)
	{
		$con = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die ( 'Could not connect to MySQL: ' . mysql_error() );
		
		mysql_select_db(DB_NAME) or die ( 'Could not select the database: ' . mysql_error() );
		
		return $con;
	}
	
	function closeDB($con)
	{
		mysql_close($con);
	}
	
	function executeSQL($mySQL)
	{
		$con = openDB($con);
		
		mysql_query($mySQL) or die ( 'Could not execute query: ' . mysql_error() );
		
		closeDB($con);
	}
	
	function readSQL($mySQL)
	{
		$arr = array();
		$i=0;
		
		$con = openDB($con);
		
		$result = mysql_query($mySQL);
		
		$arr =mysql_fetch_rowsarr($result);
		
		mysql_free_result($result);
		
		closeDB($con);
		
		return $arr;	
	}
	
	function mysql_fetch_rowsarr($result, $numass=MYSQL_BOTH) 
	{
		$got = array();

  		if(mysql_num_rows($result) == 0)
    		return $got;

  		mysql_data_seek($result, 0);
  
  		while ($row = mysql_fetch_array($result, $numass)) 
  		{
    		array_push($got, $row);
  		}
  
  		return $got;
	}
?>
